package com.itheima.demo1;

import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        int[] myRedBalls = new int[]{10, 12, 30, 16, 7, 17};
        int[] redBalls = new int[6];
        int blueBall = 0;
        boolean[] flag = new boolean[36];
        for(int i = 0; i < redBalls.length; i++){
            redBalls[i] = (int)(Math.random() * 35) + 1;
            if(flag[redBalls[i]]) {
                i--;
            }
            else{
                flag[redBalls[i]] = true;
            }
        }
        blueBall = (int)(Math.random() * 15) + 1;
        Arrays.sort(redBalls);
        for (int t : redBalls){
            System.out.print(t + " ");
        }
        System.out.println(blueBall);
        int redCount = 0;
        for (int t : redBalls){
            for (int i : myRedBalls){
                if (t == i){
                    redCount++;
                    break;
                }
            }
        }
        System.out.println("中奖了" + redCount + "个红球" + (blueBall == 12 ? "和一个篮球" : "，蓝球未中奖"));

    }
}
